package com.yfp.tissue.service.impl;

import com.yfp.common.datascope.annotation.DataScope;
import com.yfp.common.security.utils.SecurityUtils;
import com.yfp.system.api.model.LoginUser;
import com.yfp.tissue.domain.entity.PositionDraw;
import com.yfp.tissue.domain.vo.PositionDrawVO;
import com.yfp.tissue.mapper.PositionDrawMapper;
import com.yfp.tissue.service.PositionDrawService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 抽奖
 *
 * @CreateDate: 2024/9/19 11:45
 * @UpdateUser:
 * @UpdateDate: 2024/9/19 11:45
 * @UpdateRemark: 暂无修改
 * @Version: 1.0
 */
@Service
public class PositionDrawServiceImpl implements PositionDrawService {
    @Autowired
    private PositionDrawMapper positionDrawMapper;

    @DataScope(deptAlias = "pd")
    @Override
    public List<PositionDrawVO> findPage(PositionDraw positionDraw) {
        return positionDrawMapper.findPage(positionDraw);
    }

    @Override
    public void insert(PositionDraw positionDraw) {
        LoginUser loginUser = SecurityUtils.getLoginUser();
        positionDraw.setDeptId(loginUser.getSysUser().getDeptId());
        positionDrawMapper.insert(positionDraw);
    }

    @Override
    public void edit(PositionDraw positionDraw) {
        positionDrawMapper.edit(positionDraw);
    }

    @Override
    public void delById(Long id) {
        positionDrawMapper.delById(id);
    }

    @Override
    public List<PositionDrawVO> findByStatus(Integer status) {
        return positionDrawMapper.findByStatus(status);
    }
}
